package com.simple.datax.schedule.impl;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.common.logger.Logger;
import com.alibaba.dubbo.common.logger.LoggerFactory;
import com.simple.datax.SimpleResentMessage;
import com.simple.datax.service.ResentService;

/**
 * @Title: AsyncResentWorker.java
 * @Package com.simple.datax.schedule.impl
 * @Description: 异步重发操作者
 * @author Paladin Chen
 * @date 2013-1-14 下午12:48:12
 * @version V1.0
 */
@Component
public class AsyncResentWorker {
	private static final Logger logger = LoggerFactory.getLogger(AsyncResentWorker.class);
	private ResentService resentService;

	@Async
	public void work(SimpleResentMessage srm) {
		try {
			logger.debug("Begin to Resent.");
			
			resentService.resent(srm);
			
			logger.debug("End Resent.");
		} catch (Exception e) {
			logger.error("Resent () Error:", e);
		}
	}

	public ResentService getResentService() {
		return resentService;
	}

	public void setResentService(ResentService resentService) {
		this.resentService = resentService;
	}	
}
